package com.jeeplus.test.jlnu.employmentInfo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jeeplus.test.jlnu.admissionInfo.domain.entity.AdmissionInfo;
import com.jeeplus.test.jlnu.admissionInfo.domain.entity.AllInfo;
import com.jeeplus.test.jlnu.archivalInfo.domain.entity.ArchParmerter;
import com.jeeplus.test.jlnu.employmentInfo.domain.entity.EmploymentInfo;
import com.jeeplus.test.jlnu.employmentInfo.domain.vo.EmploymentInfoRespVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;


@Mapper
public interface EmploymentInfoMapper extends BaseMapper<EmploymentInfo> {

    @Select({
            "<script>",
            "SELECT em.*,",
            "       ad.student_id AS studentId,",
            "       ad.grade AS grade,",
            "       ad.class_id AS class_id,",
            "       ad.age AS age,",
            "       ad.school_code AS school_code,",
            "       ad.graduation_college AS graduation_college,",
            "       ad.major_code AS major_code,",
            "       ad.qualification AS qualification,",
            "       ad.entrance_date AS entrance_date,",
            "       ad.graduation_date AS graduation_date,",
            "       ad.gender AS gender,",
            "       ad.birthday AS birthday,",
            "       ad.political_outlook AS politicalOutlook,",
            "       ad.nation AS nation,",
            "       ad.id_card AS idCard,",
            "       ad.plan_nature AS planNature,",
            "       ad.admission_schools AS admissionSchools,",
            "       ad.admission_academy AS admissionAcademy,",
            "       ad.admission_major AS admissionMajor,",
            "       ad.admission_time AS admissionTime,",
            "       ad.gradation AS gradation,",
            "       ad.educational_system AS educationalSystem,",
            "       ad.learning_forms AS learningForms,",
            "       ad.examinee_sort AS examineeSort,",
            "       ad.batch AS batch,",
            "       ad.graduation_school AS graduationSchool,",
            "       ad.source_area AS sourceArea,",
            "       ad.area_name AS areaName,",
            "       ad.home_address AS homeAddress,",
            "       ad.postal_code AS postalCode,",
            "       ad.phone_num AS phoneNum,",
            "       ad.info_source AS infoSource,",
            "       ad.remarks AS remarks,",
            "       ad.ext1 AS ext1,",
            "       ad.ext2 AS ext2,",
            "       ad.ext3 AS ext3,",
            "       ad.ext4 AS ext4,",
            "       ad.ext5 AS ext5,",
            "       ad.ext6 AS ext6,",
            "       ad.ext7 AS ext7,",
            "       ad.ext8 AS ext8,",
            "       ad.ext9 AS ext9,",
            "       ad.ext10 AS ext10,",
            "       ad.ext11 AS ext11,",
            "       ad.ext12 AS ext12,",
            "       ad.ext13 AS ext13,",
            "       ad.ext14 AS ext14,",
            "       ad.ext15 AS ext15,",
            "       ad.ext16 AS ext16,",
            "       ad.ext17 AS ext17,",
            "       ad.ext18 AS ext18,",
            "       ad.ext19 AS ext19,",
            "       ad.ext20 AS ext20",
            "FROM jlnu_employment_info em",
            "LEFT JOIN jlnu_admission_info ad O N em.student_id = ad.student_id",
            "WHERE 1=1",
            "<if test='employmentInfoReqVo.name != null and employmentInfoReqVo.name != \"\"'>",
            "AND ad.name = #{employmentInfoReqVo.name}",
            "</if>",
            "<if test='employmentInfoReqVo.studentId != null and employmentInfoReqVo.studentId != \"\"'>",
            "AND ad.student_id = #{employmentInfoReqVo.studentId}",
            "</if>",
            "<if test='employmentInfoReqVo.admissionAcademy != null and employmentInfoReqVo.admissionAcademy != \"\"'>",
            "AND ad.admission_academy = #{employmentInfoReqVo.admissionAcademy}",
            "</if>",
            "<if test='employmentInfoReqVo.admissionMajor != null and employmentInfoReqVo.admissionMajor != \"\"'>",
            "AND ad.admission_major = #{employmentInfoReqVo.admissionMajor}",
            "</if>",
            "<if test='employmentInfoReqVo.phoneNum != null and employmentInfoReqVo.phoneNum != \"\"'>",
            "AND ad.phone_num = #{employmentInfoReqVo.phoneNum}",
            "</if>",
            "</script>"
    })
    Page<EmploymentInfoRespVo> getEmploymentInfoPage(ArchParmerter employmentInfoReqVo, Page<EmploymentInfoRespVo> page);

    AdmissionInfo selectAdmissionById(String studentId);



}
